{include file="Public:header" /}

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeIn">
     <!--    <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>商城设置 <small class="m-l-sm">这是一个自定义面板</small></h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="dropdown-toggle" data-toggle="dropdown" href="base_config.html#">
                                <i class="fa fa-wrench"></i>
                            </a>
                            <ul class="dropdown-menu dropdown-user">
                                <li><a href="base_config.html#">选项1</a>
                                </li>
                                <li><a href="base_config.html#">选项2</a>
                                </li>
                            </ul>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <h2>
                            Bootstrap<br/>
                        </h2>
                        <p>
                            简洁、直观、强悍的前端开发框架，让web开发更迅速、简单。</p>
                    </div>
                </div>
            </div>
        </div> -->
        <div class="row">
            <div class="col-sm-12">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true"> 网站设置</a>
                        </li>
                       <!--  <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">基本设置</a>
                        </li> -->
                        <!-- <li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">邮件设置</a>
                        </li> -->
                        <!-- <li class=""><a data-toggle="tab" href="#tab-4" aria-expanded="false">水印设置</a>
                        </li> -->
                    </ul>
                    <div class="tab-content">
                        <div id="tab-1" class="tab-pane active">
                            <div class="panel-body">
                                <form method="post" action="__URL__/setConfig" enctype="multipart/form-data" class="form-horizontal">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">网站名称</label>
                                        <div class="col-sm-5">
                                            <input type="text" name="store_name" value="{$config.store_name}" class="form-control">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">网站备案号</label>
                                        <div class="col-sm-5">
                                            <input type="text" name="record_no" value="{$config.record_no}" class="form-control">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">网站标题</label>
                                        <div class="col-sm-5">
                                            <input type="text" name="store_title" value="{$config.store_title}" class="form-control">
                                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 商店的标题将显示在浏览器的标题栏</span>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                     <div class="form-group">
                                        <label class="col-sm-2 control-label">网站描述</label>
                                        <div class="col-sm-5">
                                            <input type="text" name="store_desc" value="{$config.store_desc}" class="form-control">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">网站关键字</label>
                                        <div class="col-sm-5">
                                            <input type="text" class="form-control" name="store_keyword" value="{$config.store_keyword}"> 
                                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 网站关键字，便于SEO</span>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                      <div class="form-group">
                                        <label class="col-sm-2 control-label">网站Logo</label>
                                        <div class="col-sm-5">
                                              <div id="file-pretty">
					                                <label class="font-noraml">文件选择（单选）</label>
					                                <input type="file" name="store_logo" class="form-control">
					                                <!-- <label class="font-noraml">文件选择（多选）</label>
					                                <input type="file" name="filedata_two[]" multiple="multiple" class="form-control"> -->
					                                {if condition="$config['store_logo']"}
			                                             <a target="_blank" href="{$config.store_logo}"><i class="fa fa-image fa-2x"></i></a>
			                                             <input type="hidden" name="old_store_logo" value="{$config.store_logo}" />
			                                        {/if} 
			                                       {$editor}
					                        </div>
					                         <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 温馨提示：图片尺寸建议为：200*200，图片小于4M</span>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                 
                                    <!-- <div class="form-group">
                                        <label class="col-sm-3 control-label no-padding-right" >商城LOGO</label>

                                        <div class="col-sm-5">
                                            <input type="hidden" name="checkpic" id="checkpic" value="" />
                                            <input type="hidden" name="oldcheckpic" id="oldcheckpic" value="" />
                                            <input type="hidden" name="oldcheckpicname" id="oldcheckpic" value="" />
                                            <a href="javascript:void(0);" title="点击选择所要上传的图片">
                                                <input type="file" name="photo" id="file0" multiple="multiple"/>
                                            </a>
                                            <div><img src="" height="70" id="img0" ></div>
                                        </div>
                                    </div> 
                                    <div class="hr-line-dashed"></div>-->
                                    
                                    
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系人</label>
                                        <div class="col-sm-5">
                                            <input type="text" name="contact" value="{$config.contact}" placeholder="" class="form-control">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系电话</label>
                                        <div class="col-sm-5">
                                            <input type="text" name="phone" value="{$config.phone}" placeholder="" class="form-control">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                     <div class="form-group">
                                        <label class="col-sm-2 control-label">联系手机</label>
                                        <div class="col-sm-5">
                                            <input type="text" name="mobile" value="{$config.mobile}" placeholder="" class="form-control">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">邮箱</label>
                                        <div class="col-sm-5">
                                            <input type="text" name="email" value="{$config.email}" placeholder="" class="form-control">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">联系地址</label>
                                        <div class="col-sm-10">
                                        	<div class="col-sm-2">
	                                            <select name="province" class="form-control">
	                                            </select>
                                            </div>
                                            
                                            <div class="col-sm-2">
	                                            <select name="city" class="form-control">
	                                            </select>
                                            </div>
                                            
                                            <div class="col-sm-2">
	                                            <select name="district" class="form-control">
	                                            </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">详细地址</label>
                                        <div class="col-sm-5">
                                            <input type="text" name="address" value="{$config.address}" placeholder="" class="form-control">
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                    
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">平台客服QQ</label>
                                        <div class="col-sm-5">
                                            <input type="text" name="qq" value="{$config.qq}"" placeholder="" class="form-control">
                                            <span class="help-block"><i class="fa fa-info-circle"></i> 多个客服的QQ号码，请在每个号码之间使用半角逗号（,）分隔</span>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                             	 <div class="form-group">
                                        <label id="wangjj" class="col-sm-2 control-label">网站公告</label>
                                        <div class="col-sm-8">
									<textarea id="editor" name="introduce" title="">{$config.introduce|htmlspecialchars_decode}</textarea>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
									
									<input type="hidden" name="inc_type" value="shop_info"/>
									
                                    <div class="form-group">
                                        <div class="col-sm-5 col-sm-offset-2">
                                            <button id="subcontent" class="btn btn-primary" type="submit">保存内容</button>
                                            <button class="btn btn-white" type="submit">取消</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        
                        
                        <div id="tab-2" class="tab-pane">
                            <div class="panel-body">
                            <form method="post" action="__URL__/setConfig" enctype="multipart/form-data" class="form-horizontal">
                               		<div class="form-group">
                                        <label class="col-sm-2 control-label">网站语言</label>
                                        <div class="col-sm-5">
                                           <select name="lang" class="form-control">
                                           		<option value="">zh-cn</option>
                                           		<option value="">en-us</option>
                                           </select>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                     
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">附件上传大小</label>
                                        <div class="col-sm-5">
                                            <select name="lang" class="form-control">
                                           		<option value="">1M</option>
                                           		<option value="">2M</option>
                                           		<option value="">3M</option>
                                           		<option value="">4M</option>
                                           		<option value="">5M</option>
                                           		<option value="">10M</option>
                                           </select>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">首页热门搜索词</label>
                                        <div class="col-sm-5">
                                        	<input name="keyword" class="form-control" value="" />
                                        	<span class="help-block"><i class="fa fa-info-circle"></i> 多个热门搜索关键词请用竖线|分开，如（手机|电脑）</span>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    
                                </form>
                            </div>
                        </div>
                        
                        	<div id="tab-3" class="tab-pane">
	                            <div class="panel-body">
	                              <form	action="__URL__/setConfig" method="post" id="handlepost" class="form-horizontal">
	                                    <div class="form-group">
	                                        <label class="col-sm-2 control-label">邮件发送服务器（SMTP）</label>
	                                        <div class="col-sm-5">
	                                        	<input name="smtp_server" class="form-control" value="{$config['smtp_server']}" />
	                                        	<span class="help-block"><i class="fa fa-info-circle"></i> 发送邮箱的smtp地址。如: smtp.gmail.com或smtp.qq.com</span>
	                                        </div>
	                                    </div>
	                                    <div class="hr-line-dashed"></div>
	                                    
	                                    <div class="form-group">
	                                        <label class="col-sm-2 control-label">服务器(SMTP)端口</label>
	                                        <div class="col-sm-5">
	                                        	<input name="smtp_port" class="form-control" value="{$config['smtp_port']}" />
	                                        	<span class="help-block"><i class="fa fa-info-circle"></i> smtp的端口。默认为25。具体请参看各STMP服务商的设置说明 （如果使用Gmail或qq邮箱，请将端口设为465，163邮箱为25）</span>
	                                        </div>
	                                    </div>
	                                    <div class="hr-line-dashed"></div>
	                                    
	                                    <div class="form-group">
	                                        <label class="col-sm-2 control-label">邮箱账号</label>
	                                        <div class="col-sm-5">
	                                        	<input name="smtp_user" class="form-control" value="{$config['smtp_user']}" />
	                                        </div>
	                                    </div>
	                                    <div class="hr-line-dashed"></div>
	                                    
	                                    <div class="form-group">
	                                        <label class="col-sm-2 control-label">邮箱密码</label>
	                                        <div class="col-sm-5">
	                                        	<input name="smtp_pwd" class="form-control" value="{$config['smtp_pwd']}" />
	                                        	<span class="help-block"><i class="fa fa-info-circle"></i>密码  注意: 163和QQ邮箱是授权码；不是登录的密码</span>
	                                        </div>
	                                    </div>
	                                    <div class="hr-line-dashed"></div>
	                                    
	                                    <div class="form-group">
	                                        <label class="col-sm-2 control-label">注册启用邮箱验证</label>
	                                        <div class="col-sm-5 radio-inline i-check">
	                                       	 <input type="radio" name="" value="" checked/> 是
	                                       	 <input type="radio" name="" value="" /> 否
	                                      	</div>
	                                    </div>
	                                    <div class="hr-line-dashed"></div>
	                                    
	                                    <div class="form-group">
	                                        <label class="col-sm-2 control-label">测试收件邮箱</label>
	                                        <div class="col-sm-5">
	                                        	<input name="test_eamil" class="form-control" value="{$config['test_eamil']}" />
	                                        	<span class="help-block"><i class="fa fa-info-circle"></i> 首次请先保存配置再测试</span>
	                                        	<a href="javascript:void(0);" class="btn btn-info" onclick="sendEmail()">测试发送</a>
	                                        </div>
	                                    </div>
	                                    <div class="hr-line-dashed"></div>
	                                    
	                                    <div class="form-group">
                                        <div class="col-sm-5 col-sm-offset-2">
                                        	<input type="hidden" name="inc_type" value="smtp">
                                            <button id="subcontent"  class="btn btn-primary" type="submit">保存内容</button>
                                            <button class="btn btn-white" type="submit">取消</button>
                                        </div>
                                    </div>
                                    </form>
	                            </div>
                            </div>
                            
                            
                      <!--     	<div id="tab-4" class="tab-pane">
                           <div class="panel-body">
                             <form	action="" methpd="post"  class="form-horizontal">
                                   <div class="form-group">
                                       <label class="col-sm-2 control-label">商品图片添加水印</label>
                                       <div class="col-sm-5 radio-inline i-check">
                                       	 <input type="radio" name="keyword" value="" checked/> 是
                                       	 <input type="radio" name="keyword" value="" /> 否
                                       </div>
                                   </div>
                                   <div class="hr-line-dashed"></div>
                                   
                                   <div class="form-group">
                                       <label class="col-sm-2 control-label">水印类型</label>
                                       <div class="col-sm-5 radio-inline i-check">
                                       	 <input type="radio" name="keyword" value="" checked/> 文字
                                       	 <input type="radio" name="keyword" value="" /> 图片
                                       </div>
                                   </div>
                                   <div class="hr-line-dashed"></div>
                                   
                                   <div class="form-group">
                                       <label class="col-sm-2 control-label">水印图片</label>
                                       <div class="col-sm-5">
                                       	<input name="keyword" class="form-control" value="" />
                                       </div>
                                   </div>
                                   <div class="hr-line-dashed"></div>
                                   
                                   <div class="form-group">
                                       <label class="col-sm-2 control-label">水印添加条件</label>
                                       <div class="col-sm-5">
                                       	<input name="keyword" class="form-control" value="" />
                                       </div>
                                   </div>
                                   <div class="hr-line-dashed"></div>
                                   
                                   <div class="form-group">
                                       <label class="col-sm-2 control-label">水印透明度</label>
                                       <div class="col-sm-5">
                                       	<input name="keyword" class="form-control" value="" />
                                       </div>
                                   </div>
                                   <div class="hr-line-dashed"></div>
                                   
                                   <div class="form-group">
                                      <div class="col-sm-5 col-sm-offset-2">
                                          <button id="subcontent" class="btn btn-primary" type="submit">保存内容</button>
                                          <button class="btn btn-white" type="submit">取消</button>
                                      </div>
                                  </div>
                                  </form>
                           </div>
                          </div> -->
                            
                    </div>
                </div>
            </div>
        </div>
    </div>
    
   
    
    
    <script>
       /*   $("#file0").change(function(){
            var objUrl = getObjectURL(this.files[0]);
            console.log("objUrl = "+objUrl);
            if (objUrl) {
                $("#img0").attr("src", objUrl);
            }
        }) ;
        //建立一個可存取到該file的url
        function getObjectURL(file) {
            var url = null ;
            if (window.createObjectURL!=undefined) { // basic
                url = window.createObjectURL(file) ;
            } else if (window.URL!=undefined) { // mozilla(firefox)
                url = window.URL.createObjectURL(file) ;
            } else if (window.webkitURL!=undefined) { // webkit or chrome
                url = window.webkitURL.createObjectURL(file) ;
            }
            return url ;
        } */
    </script>
   
    {include file="Public:footer" /}
    <script src="__PUBLIC__/Home/js/region_select.js"></script>
    <script type="text/javascript">
                new PCAS('province', 'city', 'district', '{$config['province']?$config['province']:'广东省'}', '{$config['city']?$config['city']:'广州市'}', '{$config['district']?$config['district']:'天河区'}');
    </script>
    
	<script src="__PUBLIC__/ueditor/ueditor.config.js" type="text/javascript"></script>
    <script src="__PUBLIC__/ueditor/ueditor.all.js" type="text/javascript"></script>
	<script>
           UE.getEditor('editor');
           /* UE.getEditor('editor', {
               theme:"default", //皮肤
               lang:'zh-cn', //语言
               serverUrl: '/server/ueditor/controller.php'
           }); */

          /*UE.getEditor('editor');
            UE.getEditor('requirement');
            UE.getEditor('prize_set'); */
 	</script>  
 
<script src="__PUBLIC__/Admin/js/plugins/prettyfile/bootstrap-prettyfile.js"></script>
 <script>
 $(function(){
	$('#file-pretty input[type="file"]').prettyFile();
	$('.input-large').val('{$config['store_logo']}');
  });
 
    $("#handlepost").submit(function(){
    	if($('input[name="smtp_server"]').val() == ''){
    		layer.msg('请填写邮件发送服务器地址', {icon: 2,time: 2000});
    		return false;
    	}
    	if($('input[name="smtp_user"]').val() == ''){
    		layer.msg('请填写正确的邮箱账号', {icon: 2,time: 2000});
    		return false;
    	}
    	if($('input[name="smtp_pwd"]').val() == ''){
    		layer.msg('请填写发送邮箱密码', {icon: 2,time: 2000});
    		return false;
    	}
    });
/* var flag = true;
function adsubmit(){
	check_form();
	if(flag){
		$('#handlepost').submit();
	}else{
		return flag;
	}
}

function check_form(){
	if($('input[name="smtp_server"]').val() == ''){
		alert('请填写邮件发送服务器地址');
		flag = false;
		return;
	}
	if($('input[name="smtp_user"]').val() == '' || !checkEmail($('input[name="smtp_user"]').val())){
		alert('请填写正确的邮箱账号');
		flag = false;
		return;
	}
	if($('input[name="smtp_pwd"]').val() == ''){
		alert('请填写发送邮箱密码');
		flag = false;
		return;
	}
}

$(document).ready(function(){
	get_province();
}); */

function goset(obj){
	window.location.href = $(obj).attr('data-url');
}

function sendEmail(){
	if($('input[name="test_eamil"]').val() == ''){
		alert('请填写正确的测试邮箱账号');
		return;
	}else{
		$.ajax({
			type : "post",
			data : $('#handlepost').serialize(),
			dataType : 'json',
			url : "__URL__/send_email",
			success : function(res){
				if(res==1){
					layer.msg('发送成功', {icon: 1});
				}else{
					layer.msg('发送失败', {icon: 2,time: 2000});
				}
			}
		})
	}
}
</script>